if (!jsx3.lang.Class.forName("tibco.admin.enterpriseAssets.servers.runtimeParams.AdminRuntime")) {
    tibco.admin.Main.loadResource("tibco/admin/enterpriseAssets/servers/runtimeParams/jss/jss.xml", "tibco.admin", "jss900E", "ljss", false);
    jsx3.Class.defineClass(
            'tibco.admin.enterpriseAssets.servers.runtimeParams.AdminRuntime', // full name of the class to create
            jsx3.lang.Object, //  extends jsx3.lang.Object
            null, // dose not implements any interfaces
            function(adminRuntime) {
                adminRuntime.nodeName = null;
                adminRuntime.cacheDoc = null;
                adminRuntime.subscribeAll = function() {
                    //tibco.admin.PubSub.subscribe("nodeProperties.nodeDetailsObtained", adminRuntime.populateAdminNodeParams);
                }

                //nodeJVMPropertiesCache_222
                adminRuntime.populateAdminNodeParams = function(objEvent) {
                    adminRuntime.nodeName = (objEvent)?objEvent.nodeName:null;
                    adminRuntime.cacheDoc = tibco.admin.Main.getServer().getCache().getDocument('nodeRuntimeDataCache900E');
                    if (adminRuntime.cacheDoc == null) {
                        adminRuntime.callgetAdminNodeConfiguration();
                    } else {
                        adminRuntime.populateListAndEditScreen();
                    }
                }

                //call this method to begin the service call (eg.service.callgetAdminNodeConfiguration();)
                adminRuntime.callgetAdminNodeConfiguration = function() {
                    var objService = tibco.admin.Main.loadService("tibco.admin",
                            "tibco/admin/enterpriseAssets/servers/runtimeParams/rules/getAdminRuntimeParametersRules.xml",
                            "getAdminNodeConfiguration",
                            "get admin nodes configuration.");
                    //subscribe and call
                    objService.subscribe(jsx3.net.Service.ON_SUCCESS, adminRuntime.ongetAdminNodeConfigurationSuccess);
                    objService.subscribe(jsx3.net.Service.ON_ERROR, adminRuntime.ongetAdminNodeConfigurationError);
                    objService.subscribe(jsx3.net.Service.ON_INVALID, adminRuntime.ongetAdminNodeConfigurationInvalid);
                    objService.setEndpointURL(tibco.admin.util.ServiceHelper.getAdminConfigurationEndpointURL())
                    objService.doCall();
                };

                adminRuntime.ongetAdminNodeConfigurationSuccess = function(objEvent) {
                    adminRuntime.populateListAndEditScreen();
                };

                adminRuntime.ongetAdminNodeConfigurationError = function(objEvent) {
                };

                adminRuntime.ongetAdminNodeConfigurationInvalid = function(objEvent) {
                };

                adminRuntime.populateListAndEditScreen = function() {
                    var mtxList = tibco.admin.Main.getServer().getJSXByName('mtxadminRuntimeParamsList900F');
                    mtxList.repaint();
                    adminRuntime.cacheDoc = mtxList.getXML();
                    var workspace = tibco.admin.Main.getServer().getJSXByName('blkEditFields900F');
                    workspace.removeChildren();
                    var recordNodesInCache = adminRuntime.cacheDoc.selectNodes("//record");
                    for (var i = 0; i < recordNodesInCache.getLength(); i++) {

                        var record = recordNodesInCache.getItem(i);
                        var objChild = workspace.load("tibco/admin/enterpriseAssets/servers/runtimeParams/components/adminRuntimeParamLabel.xml", true);
                        objChild.getDescendantOfName("txtPropertyName900F", true, false).setValue(record.getAttribute("propertyname"));
                        var valueTextField = objChild.getDescendantOfName("txtPropertyValue900F", true, false).setValue(record.getAttribute("propertyvalue"));
                        objChild.getDescendantOfName("txtPropertyName900F", true, false).getParent().setName(record.getAttribute("jsxid"));
                    }
                }

                adminRuntime.addPropertyToList = function(block) {
                    var propertynamefield = block.getDescendantOfName('txtNewPropertyName900F', true, false);
                    var propertyvaluefield = block.getDescendantOfName('txtNewPropertyValue900F');
                    jsx3.require("tibco.admin.util.Validation");
                    if (tibco.admin.util.Validation.doValidateNotEmptyNoWhSpace(propertynamefield, propertynamefield.getValue()) &&
                        tibco.admin.util.Validation.doValidateNotEmptyNoWhSpace(propertyvaluefield, propertyvaluefield.getValue())) {
                        var objParent = adminRuntime.cacheDoc.getRootNode();
                        var record = objParent.createNode(jsx3.xml.Entity.TYPEELEMENT, "record");
                        record.setAttribute("jsxid", jsx3.xml.CDF.getKey());
                        record.setAttribute("propertyname", propertynamefield.getValue());
                        record.setAttribute("propertyvalue", propertyvaluefield.getValue());
                        record.setAttribute("propertytype", "String");
                        record.setAttribute("required", "false");
                        record.setAttribute("mask", "false");
                        record.setAttribute("editable", "false");
                        record.setAttribute("displayname", propertynamefield.getValue());
                        tibco.admin.util.Log.SERVICE.trace("The new record is [\n" + record + "]");
                        objParent.appendChild(record);
                        tibco.admin.Main.getServer().getJSXByName("btnSaveRuntime_900F").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                        var workspace = tibco.admin.Main.getServer().getJSXByName("blkEditFields900F");
                        var objChild = workspace.load("tibco/admin/enterpriseAssets/servers/runtimeParams/components/adminRuntimeParamLabel.xml", true);
                        objChild.getDescendantOfName("txtPropertyName900F", true, false).setValue(record.getAttribute("propertyname"));
                        var valueTextField = objChild.getDescendantOfName("txtPropertyValue900F", true, false).setValue(record.getAttribute("propertyvalue"));
                        objChild.getDescendantOfName("txtPropertyName900F", true, false).getParent().setName(record.getAttribute("jsxid"));
                        objChild.getDescendantOfName("blkDelete900F", true, false).setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                    }
                }

                adminRuntime.deletePropertyFromList = function(block) {
                    var jsxid = block.getDescendantOfName("txtPropertyName900F", true, false).getParent().getName();
                    if (adminRuntime.cacheDoc) {
                        var recordToDelete = adminRuntime.cacheDoc.selectSingleNode("//record[@jsxid='" + jsxid + "']");
                        if (recordToDelete) {
                            var parentNode = recordToDelete.getParent();
                            parentNode.removeChild(recordToDelete);
                        }
                    }
                    var parentBlock = block.getParent();
                    parentBlock.removeChild(block);
                }

                adminRuntime.editRuntimeDetails = function(button) {
                    var workspace = tibco.admin.Main.getServer().getJSXByName("blkDisplayRuntimeSpace900F");
                    if (workspace.getDisplay() == jsx3.gui.Block.DISPLAYBLOCK) {
                        workspace.setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        tibco.admin.Main.getServer().getJSXByName("blkEditRuntimeSpace900F").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        button.getParent().getChild("btnSaveRuntime_900F").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        button.getParent().getChild("btnCancelRuntime_900F").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true)
                        button.getParent().getChild("btnEditRuntime_900F").setDisplay(jsx3.gui.Block.DISPLAYNONE, true)
                    }
                    else {
                        workspace.setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        tibco.admin.Main.getServer().getJSXByName("blkEditRuntimeSpace900F").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        button.getParent().getChild("btnSaveRuntime_900F").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        button.getParent().getChild("btnCancelRuntime_900F").setDisplay(jsx3.gui.Block.DISPLAYNONE, true)
                        button.getParent().getChild("btnEditRuntime_900F").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true)
                    }
                }

                adminRuntime.cancelRuntimeDetailsEdit = function(button) {
                    var workspace = tibco.admin.Main.getServer().getJSXByName("blkEditFields900F");
                    var allParams = workspace.getChildren();
                    if (allParams.length != 0) {
                        for (var i = 0; i < allParams.length; i++) {
                            if (!adminRuntime.isSaved(allParams[i])) {
                                workspace.removeChild(allParams[i]);
                            }
                        }

                    }
                    adminRuntime.editRuntimeDetails(button);
                }

                adminRuntime.isSaved = function(newBlock) {
                    return !(newBlock && newBlock.getDescendantOfName('blkDelete900F').getDisplay() == jsx3.gui.Block.DISPLAYNONE);
                }

                //javascript:tibco.resource.runtimeParams.AdminRuntime.deletePropertyFromList(tibco.admin.Main.getServer().getJSXById(this.getAttribute('id')).getAncestorOfName('rootRuntimeParam900F')

                adminRuntime.callupdateAdminNodeJVMParams = function() {
                    var objService = tibco.admin.Main.loadService("tibco.admin",
                            "tibco/admin/enterpriseAssets/servers/runtimeParams/rules/updateRuntimeParamsRules.xml",
                            "updateAdminNodeJVMParams",
                            "update admin nodes runtime params.");
                    //subscribe and call
                    objService.setEndpointURL(tibco.admin.util.ServiceHelper.getAdminConfigurationEndpointURL())
                    objService.subscribe(jsx3.net.Service.ON_SUCCESS, adminRuntime.onupdateAdminNodeJVMParamsSuccess);
                    objService.subscribe(jsx3.net.Service.ON_ERROR, adminRuntime.onupdateAdminNodeJVMParamsError);
                    objService.subscribe(jsx3.net.Service.ON_INVALID, adminRuntime.onupdateAdminNodeJVMParamsInvalid);
                    objService.doCall();
                };

                adminRuntime.onupdateAdminNodeJVMParamsSuccess = function(objEvent) {
                    adminRuntime.editRuntimeDetails(tibco.admin.Main.getServer().getJSXByName("btnSaveRuntime_900F"))
                };

                adminRuntime.onupdateAdminNodeJVMParamsError = function(objEvent) {
                };

                adminRuntime.onupdateAdminNodeJVMParamsInvalid = function(objEvent) {
                };

            });
}